go to previous page   go to home page   go to next page hear noise

Answer:

With a loop that counts 1 to numStars and prints a * for each iteration.


Printing a Row of Stars

Here is the answer to the little problem. The parts of the program that don't affect it have been (temporarily) cleared away.


    // collect input data from user
    System.out.print( "How many Stars per Row? " );
    numStars = scan.nextInt() ;


      int star = ;
      
      while ( star <=  )
      {
        System.out.print("*");
        
        
      }

      System.out.println();


QUESTION 21:

Need I ask? Fill in the blanks so that numStars stars are printed.